package com.sky.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;

@Mapper
public interface WorkspaceMapper {
    @Select("SELECT count(*) from employee WHERE create_time >#{begin} and create_time<#{end}")
    int getNewUser(LocalDateTime begin, LocalDateTime end);

    @Select("SELECT count(DISTINCT user_id) from orders WHERE order_time >#{begin} and order_time<#{end} and status=5")
    int getUserCount(LocalDateTime begin, LocalDateTime end);//当天下单的用户个数

    @Select("SELECT count(*) from setmeal WHERE status=0")
    int getDiscontinued();
    @Select("SELECT count(*) from setmeal WHERE status=1")
    int getSold();
    @Select("SELECT count(*) from dish WHERE status=0")
    int getDiscontinuedByDish();
    @Select("SELECT count(*) from dish WHERE status=1")
    int getSoldByDish();

    @Select("SELECT count(*) from orders")
    int getOrders();//订单总数

    @Select("SELECT count(*) from orders WHERE status=6")
    int getCancelledOrders();//取消订单数

    @Select("SELECT count(*) from orders WHERE status=5")
    int getCompletedOrders();//已完成订单数

    @Select("SELECT count(*) from orders WHERE status=3")
    int getDeliveredOrders();//待派送订单数

    @Select("SELECT count(*) from orders WHERE status=2")
    int getWaitingOrders();//待接单总数
}
